<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no , viewport-fit=cover">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="css/mui.min.css">
	<link rel="stylesheet" type="text/css" href="css/iconfont.css"/>
	<style type="text/css">
		body {background-color: #efeff4;}
		.mui-bar-tab .mui-tab-item.mui-active {color: #444444;}
		.mui-title{color:#454545;font-weight: 450;}
		* { touch-action: pan-y; } 
	</style>
</head>

<body>
	<nav class="mui-bar mui-bar-tab globe-color">
		<a id="defaultTab" class="mui-tab-item mui-active" href="www/home/home.html">
			<span class="mui-icon iconfont icon-shouye"></span>
			<span class="mui-tab-label">首页</span>
		</a>
		
		<a class="mui-tab-item" href="www/quanzi/zt.html">
			<span class="mui-icon iconfont icon-theme"></span>
			<span class="mui-tab-label">社区</span>
		</a>
		
		<a class="mui-tab-item" href= "www/publish/publish-select-type.html">
			<span class="mui-icon iconfont icon-fabu" style= "font-size: 30px; color: orangered;" ></span>
			<span class="mui-tab-label" style = "color :orangered;">发布</span>	
		</a>
		
		<a class="mui-tab-item" href="www/life/life-list.html">
			<span class="mui-icon iconfont icon-category "></span>
			<span class="mui-tab-label">生活</span>
		</a>
		<a class="mui-tab-item" href="www/me/me.html">
			<span class="mui-icon iconfont icon-wode"></span>
			<span class="mui-tab-label">个人中心</span>
		</a>
	</nav>
		
	<script src="js/mui.min.js"></script>
	<script src="js/p/app-check-update.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/p/api.js" type="text/javascript" charset="utf-8"></script>
	<script>
		mui.init();	
		var subpages = ['www/home/home.html', 'www/quanzi/zt.html', 'www/publish/publish-select-type.html', 'www/life/life-list.html','www/me/me.html'];
		
		function navigationBarStyle(index){
			var subpage_style = {top: '0px',bottom: '51px'};
			var _titles = ['','社区','发布动态','生活','个人中心']
			if(index != 1){//   , mui.os.android
				subpage_style['titleNView'] = {
					titleText:_titles[index] || '',
					// titleColor:"#f5f5f5",       
					titleSize:"18px",  
					// height:'64px',
					// backgroundColor: '#FF6225', 
					splitLine:{// 标题栏控件的底部分割线，类似borderBottom
						color:"#CCCCCC",             
						height:"0px"  ,
					},
					
					// type: index == 0 ? 'transparent' : 'default'
				};
				
				if(index == 0){
					subpage_style['titleNView']['tags'] = [
						{
							tag:'img',
							position:{
								top:'7px',
								left:'10px',
								width:'160px',
								height:'28px'
							},
							src:"images/home/633x120.png"
						}
					];
					subpage_style['titleNView']['buttons'] =[
						{
							fontSize:'15px',
							text:'签到',
							width:'60px',
							color:'#FF6225',
							fontWeight:'bold',
							onclick:function(){
								var wv = plus.webview.getWebviewById('www/home/home.html');
								mui.fire(wv,'homeusersignevent',{})
							}
							
						}
					];
				}else{
					subpage_style['titleNView']['backgroundColor'] = '#FF4500';
					subpage_style['titleNView']['titleColor'] = '#f5f5f5';
				}
				
			}
			
			return subpage_style;
		}
		
		var aniShow = {};
		mui.plusReady(function() {
			// appCheckUpdate();
			var h = plus.nativeUI.showWaiting();
			plus.screen.lockOrientation("portrait-primary");
			plus.navigator.closeSplashscreen();
			plus.navigator.setFullscreen(false);
			var self = plus.webview.currentWebview();
			for (var i = 0; i < 5; i++) {
				var temp = {};
				var _style = navigationBarStyle(i);
				var sub = plus.webview.create(subpages[i], subpages[i], _style);
				if (i > 0) {
					sub.hide();
				}else{
// 						temp[subpages[i]] = "true";
// 						mui.extend(aniShow,temp);
				}
				self.append(sub);
			}
			
			setTimeout(function(){
				h.close();
			},1500);
			
			// plus.webview.show(subpages[0]);//修复-HX2.3.7.20191024初始显示个人中心
		});
		
		var activeTab = subpages[0];
		var title = document.getElementById("title");
		 //选项卡点击事件
		mui('.mui-bar-tab').on('tap', 'a', function(e) {
			var targetTab = this.getAttribute('href');
			if (targetTab == activeTab)return;
			// var t = this.querySelector('.mui-tab-label').innerHTML;
			if(mui.os.ios||aniShow[targetTab]){
				plus.webview.show(targetTab);
			}else{
				var temp = {};
				temp[targetTab] = "true";
				mui.extend(aniShow,temp);
				plus.webview.show(targetTab,"none");
			}

			plus.webview.hide(activeTab);
			activeTab = targetTab;
		});
		
		 //自定义事件，模拟点击“首页选项卡”
		document.addEventListener('gohome', function() {
			var defaultTab = document.getElementById("defaultTab");
			//模拟首页点击
			mui.trigger(defaultTab, 'tap');
			var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
			if (defaultTab !== current) {
				current.classList.remove('mui-active');
				defaultTab.classList.add('mui-active');
			}
		});			
	</script>
</body>
</html>